// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.
//
// ███╗   ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
// ████╗  ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
// ██╔██╗ ██║██║   ██║   ██║   ██║██║     █████╗
// ██║╚██╗██║██║   ██║   ██║   ██║██║     ██╔══╝
// ██║ ╚████║╚██████╔╝   ██║   ██║╚██████╗███████╗
// ╚═╝  ╚═══╝ ╚═════╝    ╚═╝   ╚═╝ ╚═════╝╚══════╝
// ------------------------------------------------
//
// This file is automatically generated.
// Please do not edit these files manually.
//
// ------------------------------------------------

#nullable restore

using Elastic.Clients.Elasticsearch.Fluent;
using Elastic.Clients.Elasticsearch.Serialization;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Text.Json;
using System.Text.Json.Serialization;

namespace Elastic.Clients.Elasticsearch.Mapping;

public sealed partial class IcuCollationProperty : IProperty
{
	[JsonInclude, JsonPropertyName("alternate")]
	public Elastic.Clients.Elasticsearch.Analysis.IcuCollationAlternate? Alternate { get; set; }
	[JsonInclude, JsonPropertyName("case_first")]
	public Elastic.Clients.Elasticsearch.Analysis.IcuCollationCaseFirst? CaseFirst { get; set; }
	[JsonInclude, JsonPropertyName("case_level")]
	public bool? CaseLevel { get; set; }
	[JsonInclude, JsonPropertyName("copy_to")]
	[JsonConverter(typeof(SingleOrManyFieldsConverter))]
	public Elastic.Clients.Elasticsearch.Fields? CopyTo { get; set; }
	[JsonInclude, JsonPropertyName("country")]
	public string? Country { get; set; }
	[JsonInclude, JsonPropertyName("decomposition")]
	public Elastic.Clients.Elasticsearch.Analysis.IcuCollationDecomposition? Decomposition { get; set; }
	[JsonInclude, JsonPropertyName("doc_values")]
	public bool? DocValues { get; set; }
	[JsonInclude, JsonPropertyName("dynamic")]
	public Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? Dynamic { get; set; }
	[JsonInclude, JsonPropertyName("fields")]
	public Elastic.Clients.Elasticsearch.Mapping.Properties? Fields { get; set; }
	[JsonInclude, JsonPropertyName("hiragana_quaternary_mode")]
	public bool? HiraganaQuaternaryMode { get; set; }
	[JsonInclude, JsonPropertyName("ignore_above")]
	public int? IgnoreAbove { get; set; }

	/// <summary>
	/// <para>Should the field be searchable?</para>
	/// </summary>
	[JsonInclude, JsonPropertyName("index")]
	public bool? Index { get; set; }
	[JsonInclude, JsonPropertyName("index_options")]
	public Elastic.Clients.Elasticsearch.Mapping.IndexOptions? IndexOptions { get; set; }
	[JsonInclude, JsonPropertyName("language")]
	public string? Language { get; set; }

	/// <summary>
	/// <para>Metadata about the field.</para>
	/// </summary>
	[JsonInclude, JsonPropertyName("meta")]
	public IDictionary<string, string>? Meta { get; set; }
	[JsonInclude, JsonPropertyName("norms")]
	public bool? Norms { get; set; }

	/// <summary>
	/// <para>Accepts a string value which is substituted for any explicit null values. Defaults to null, which means the field is treated as missing.</para>
	/// </summary>
	[JsonInclude, JsonPropertyName("null_value")]
	public string? NullValue { get; set; }
	[JsonInclude, JsonPropertyName("numeric")]
	public bool? Numeric { get; set; }
	[JsonInclude, JsonPropertyName("properties")]
	public Elastic.Clients.Elasticsearch.Mapping.Properties? Properties { get; set; }
	[JsonInclude, JsonPropertyName("rules")]
	public string? Rules { get; set; }
	[JsonInclude, JsonPropertyName("similarity")]
	public string? Similarity { get; set; }
	[JsonInclude, JsonPropertyName("store")]
	public bool? Store { get; set; }
	[JsonInclude, JsonPropertyName("strength")]
	public Elastic.Clients.Elasticsearch.Analysis.IcuCollationStrength? Strength { get; set; }

	[JsonInclude, JsonPropertyName("type")]
	public string Type => "icu_collation_keyword";

	[JsonInclude, JsonPropertyName("variable_top")]
	public string? VariableTop { get; set; }
	[JsonInclude, JsonPropertyName("variant")]
	public string? Variant { get; set; }
}

public sealed partial class IcuCollationPropertyDescriptor<TDocument> : SerializableDescriptor<IcuCollationPropertyDescriptor<TDocument>>, IBuildableDescriptor<IcuCollationProperty>
{
	internal IcuCollationPropertyDescriptor(Action<IcuCollationPropertyDescriptor<TDocument>> configure) => configure.Invoke(this);

	public IcuCollationPropertyDescriptor() : base()
	{
	}

	private Elastic.Clients.Elasticsearch.Analysis.IcuCollationAlternate? AlternateValue { get; set; }
	private Elastic.Clients.Elasticsearch.Analysis.IcuCollationCaseFirst? CaseFirstValue { get; set; }
	private bool? CaseLevelValue { get; set; }
	private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; }
	private string? CountryValue { get; set; }
	private Elastic.Clients.Elasticsearch.Analysis.IcuCollationDecomposition? DecompositionValue { get; set; }
	private bool? DocValuesValue { get; set; }
	private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; }
	private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; }
	private bool? HiraganaQuaternaryModeValue { get; set; }
	private int? IgnoreAboveValue { get; set; }
	private bool? IndexValue { get; set; }
	private Elastic.Clients.Elasticsearch.Mapping.IndexOptions? IndexOptionsValue { get; set; }
	private string? LanguageValue { get; set; }
	private IDictionary<string, string>? MetaValue { get; set; }
	private bool? NormsValue { get; set; }
	private string? NullValueValue { get; set; }
	private bool? NumericValue { get; set; }
	private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; }
	private string? RulesValue { get; set; }
	private string? SimilarityValue { get; set; }
	private bool? StoreValue { get; set; }
	private Elastic.Clients.Elasticsearch.Analysis.IcuCollationStrength? StrengthValue { get; set; }
	private string? VariableTopValue { get; set; }
	private string? VariantValue { get; set; }

	public IcuCollationPropertyDescriptor<TDocument> Alternate(Elastic.Clients.Elasticsearch.Analysis.IcuCollationAlternate? alternate)
	{
		AlternateValue = alternate;
		return Self;
	}

	public IcuCollationPropertyDescriptor<TDocument> CaseFirst(Elastic.Clients.Elasticsearch.Analysis.IcuCollationCaseFirst? caseFirst)
	{
		CaseFirstValue = caseFirst;
		return Self;
	}

	public IcuCollationPropertyDescriptor<TDocument> CaseLevel(bool? caseLevel = true)
	{
		CaseLevelValue = caseLevel;
		return Self;
	}

	public IcuCollationPropertyDescriptor<TDocument> CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo)
	{
		CopyToValue = copyTo;
		return Self;
	}

	public IcuCollationPropertyDescriptor<TDocument> Country(string? country)
	{
		CountryValue = country;
		return Self;
	}

	public IcuCollationPropertyDescriptor<TDocument> Decomposition(Elastic.Clients.Elasticsearch.Analysis.IcuCollationDecomposition? decomposition)
	{
		DecompositionValue = decomposition;
		return Self;
	}

	public IcuCollationPropertyDescriptor<TDocument> DocValues(bool? docValues = true)
	{
		DocValuesValue = docValues;
		return Self;
	}

	public IcuCollationPropertyDescriptor<TDocument> Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic)
	{
		DynamicValue = dynamic;
		return Self;
	}

	public IcuCollationPropertyDescriptor<TDocument> Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields)
	{
		FieldsValue = fields;
		return Self;
	}

	public IcuCollationPropertyDescriptor<TDocument> Fields(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor<TDocument> descriptor)
	{
		FieldsValue = descriptor.PromisedValue;
		return Self;
	}

	public IcuCollationPropertyDescriptor<TDocument> Fields(Action<Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor<TDocument>> configure)
	{
		var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor<TDocument>();
		configure?.Invoke(descriptor);
		FieldsValue = descriptor.PromisedValue;
		return Self;
	}

	public IcuCollationPropertyDescriptor<TDocument> HiraganaQuaternaryMode(bool? hiraganaQuaternaryMode = true)
	{
		HiraganaQuaternaryModeValue = hiraganaQuaternaryMode;
		return Self;
	}

	public IcuCollationPropertyDescriptor<TDocument> IgnoreAbove(int? ignoreAbove)
	{
		IgnoreAboveValue = ignoreAbove;
		return Self;
	}

	/// <summary>
	/// <para>Should the field be searchable?</para>
	/// </summary>
	public IcuCollationPropertyDescriptor<TDocument> Index(bool? index = true)
	{
		IndexValue = index;
		return Self;
	}

	public IcuCollationPropertyDescriptor<TDocument> IndexOptions(Elastic.Clients.Elasticsearch.Mapping.IndexOptions? indexOptions)
	{
		IndexOptionsValue = indexOptions;
		return Self;
	}

	public IcuCollationPropertyDescriptor<TDocument> Language(string? language)
	{
		LanguageValue = language;
		return Self;
	}

	/// <summary>
	/// <para>Metadata about the field.</para>
	/// </summary>
	public IcuCollationPropertyDescriptor<TDocument> Meta(Func<FluentDictionary<string, string>, FluentDictionary<string, string>> selector)
	{
		MetaValue = selector?.Invoke(new FluentDictionary<string, string>());
		return Self;
	}

	public IcuCollationPropertyDescriptor<TDocument> Norms(bool? norms = true)
	{
		NormsValue = norms;
		return Self;
	}

	/// <summary>
	/// <para>Accepts a string value which is substituted for any explicit null values. Defaults to null, which means the field is treated as missing.</para>
	/// </summary>
	public IcuCollationPropertyDescriptor<TDocument> NullValue(string? nullValue)
	{
		NullValueValue = nullValue;
		return Self;
	}

	public IcuCollationPropertyDescriptor<TDocument> Numeric(bool? numeric = true)
	{
		NumericValue = numeric;
		return Self;
	}

	public IcuCollationPropertyDescriptor<TDocument> Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties)
	{
		PropertiesValue = properties;
		return Self;
	}

	public IcuCollationPropertyDescriptor<TDocument> Properties(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor<TDocument> descriptor)
	{
		PropertiesValue = descriptor.PromisedValue;
		return Self;
	}

	public IcuCollationPropertyDescriptor<TDocument> Properties(Action<Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor<TDocument>> configure)
	{
		var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor<TDocument>();
		configure?.Invoke(descriptor);
		PropertiesValue = descriptor.PromisedValue;
		return Self;
	}

	public IcuCollationPropertyDescriptor<TDocument> Rules(string? rules)
	{
		RulesValue = rules;
		return Self;
	}

	public IcuCollationPropertyDescriptor<TDocument> Similarity(string? similarity)
	{
		SimilarityValue = similarity;
		return Self;
	}

	public IcuCollationPropertyDescriptor<TDocument> Store(bool? store = true)
	{
		StoreValue = store;
		return Self;
	}

	public IcuCollationPropertyDescriptor<TDocument> Strength(Elastic.Clients.Elasticsearch.Analysis.IcuCollationStrength? strength)
	{
		StrengthValue = strength;
		return Self;
	}

	public IcuCollationPropertyDescriptor<TDocument> VariableTop(string? variableTop)
	{
		VariableTopValue = variableTop;
		return Self;
	}

	public IcuCollationPropertyDescriptor<TDocument> Variant(string? variant)
	{
		VariantValue = variant;
		return Self;
	}

	protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings)
	{
		writer.WriteStartObject();
		if (AlternateValue is not null)
		{
			writer.WritePropertyName("alternate");
			JsonSerializer.Serialize(writer, AlternateValue, options);
		}

		if (CaseFirstValue is not null)
		{
			writer.WritePropertyName("case_first");
			JsonSerializer.Serialize(writer, CaseFirstValue, options);
		}

		if (CaseLevelValue.HasValue)
		{
			writer.WritePropertyName("case_level");
			writer.WriteBooleanValue(CaseLevelValue.Value);
		}

		if (CopyToValue is not null)
		{
			writer.WritePropertyName("copy_to");
			JsonSerializer.Serialize(writer, CopyToValue, options);
		}

		if (!string.IsNullOrEmpty(CountryValue))
		{
			writer.WritePropertyName("country");
			writer.WriteStringValue(CountryValue);
		}

		if (DecompositionValue is not null)
		{
			writer.WritePropertyName("decomposition");
			JsonSerializer.Serialize(writer, DecompositionValue, options);
		}

		if (DocValuesValue.HasValue)
		{
			writer.WritePropertyName("doc_values");
			writer.WriteBooleanValue(DocValuesValue.Value);
		}

		if (DynamicValue is not null)
		{
			writer.WritePropertyName("dynamic");
			JsonSerializer.Serialize(writer, DynamicValue, options);
		}

		if (FieldsValue is not null)
		{
			writer.WritePropertyName("fields");
			JsonSerializer.Serialize(writer, FieldsValue, options);
		}

		if (HiraganaQuaternaryModeValue.HasValue)
		{
			writer.WritePropertyName("hiragana_quaternary_mode");
			writer.WriteBooleanValue(HiraganaQuaternaryModeValue.Value);
		}

		if (IgnoreAboveValue.HasValue)
		{
			writer.WritePropertyName("ignore_above");
			writer.WriteNumberValue(IgnoreAboveValue.Value);
		}

		if (IndexValue.HasValue)
		{
			writer.WritePropertyName("index");
			writer.WriteBooleanValue(IndexValue.Value);
		}

		if (IndexOptionsValue is not null)
		{
			writer.WritePropertyName("index_options");
			JsonSerializer.Serialize(writer, IndexOptionsValue, options);
		}

		if (!string.IsNullOrEmpty(LanguageValue))
		{
			writer.WritePropertyName("language");
			writer.WriteStringValue(LanguageValue);
		}

		if (MetaValue is not null)
		{
			writer.WritePropertyName("meta");
			JsonSerializer.Serialize(writer, MetaValue, options);
		}

		if (NormsValue.HasValue)
		{
			writer.WritePropertyName("norms");
			writer.WriteBooleanValue(NormsValue.Value);
		}

		if (!string.IsNullOrEmpty(NullValueValue))
		{
			writer.WritePropertyName("null_value");
			writer.WriteStringValue(NullValueValue);
		}

		if (NumericValue.HasValue)
		{
			writer.WritePropertyName("numeric");
			writer.WriteBooleanValue(NumericValue.Value);
		}

		if (PropertiesValue is not null)
		{
			writer.WritePropertyName("properties");
			JsonSerializer.Serialize(writer, PropertiesValue, options);
		}

		if (!string.IsNullOrEmpty(RulesValue))
		{
			writer.WritePropertyName("rules");
			writer.WriteStringValue(RulesValue);
		}

		if (!string.IsNullOrEmpty(SimilarityValue))
		{
			writer.WritePropertyName("similarity");
			writer.WriteStringValue(SimilarityValue);
		}

		if (StoreValue.HasValue)
		{
			writer.WritePropertyName("store");
			writer.WriteBooleanValue(StoreValue.Value);
		}

		if (StrengthValue is not null)
		{
			writer.WritePropertyName("strength");
			JsonSerializer.Serialize(writer, StrengthValue, options);
		}

		writer.WritePropertyName("type");
		writer.WriteStringValue("icu_collation_keyword");
		if (!string.IsNullOrEmpty(VariableTopValue))
		{
			writer.WritePropertyName("variable_top");
			writer.WriteStringValue(VariableTopValue);
		}

		if (!string.IsNullOrEmpty(VariantValue))
		{
			writer.WritePropertyName("variant");
			writer.WriteStringValue(VariantValue);
		}

		writer.WriteEndObject();
	}

	IcuCollationProperty IBuildableDescriptor<IcuCollationProperty>.Build() => new()
	{
		Alternate = AlternateValue,
		CaseFirst = CaseFirstValue,
		CaseLevel = CaseLevelValue,
		CopyTo = CopyToValue,
		Country = CountryValue,
		Decomposition = DecompositionValue,
		DocValues = DocValuesValue,
		Dynamic = DynamicValue,
		Fields = FieldsValue,
		HiraganaQuaternaryMode = HiraganaQuaternaryModeValue,
		IgnoreAbove = IgnoreAboveValue,
		Index = IndexValue,
		IndexOptions = IndexOptionsValue,
		Language = LanguageValue,
		Meta = MetaValue,
		Norms = NormsValue,
		NullValue = NullValueValue,
		Numeric = NumericValue,
		Properties = PropertiesValue,
		Rules = RulesValue,
		Similarity = SimilarityValue,
		Store = StoreValue,
		Strength = StrengthValue,
		VariableTop = VariableTopValue,
		Variant = VariantValue
	};
}

public sealed partial class IcuCollationPropertyDescriptor : SerializableDescriptor<IcuCollationPropertyDescriptor>, IBuildableDescriptor<IcuCollationProperty>
{
	internal IcuCollationPropertyDescriptor(Action<IcuCollationPropertyDescriptor> configure) => configure.Invoke(this);

	public IcuCollationPropertyDescriptor() : base()
	{
	}

	private Elastic.Clients.Elasticsearch.Analysis.IcuCollationAlternate? AlternateValue { get; set; }
	private Elastic.Clients.Elasticsearch.Analysis.IcuCollationCaseFirst? CaseFirstValue { get; set; }
	private bool? CaseLevelValue { get; set; }
	private Elastic.Clients.Elasticsearch.Fields? CopyToValue { get; set; }
	private string? CountryValue { get; set; }
	private Elastic.Clients.Elasticsearch.Analysis.IcuCollationDecomposition? DecompositionValue { get; set; }
	private bool? DocValuesValue { get; set; }
	private Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? DynamicValue { get; set; }
	private Elastic.Clients.Elasticsearch.Mapping.Properties? FieldsValue { get; set; }
	private bool? HiraganaQuaternaryModeValue { get; set; }
	private int? IgnoreAboveValue { get; set; }
	private bool? IndexValue { get; set; }
	private Elastic.Clients.Elasticsearch.Mapping.IndexOptions? IndexOptionsValue { get; set; }
	private string? LanguageValue { get; set; }
	private IDictionary<string, string>? MetaValue { get; set; }
	private bool? NormsValue { get; set; }
	private string? NullValueValue { get; set; }
	private bool? NumericValue { get; set; }
	private Elastic.Clients.Elasticsearch.Mapping.Properties? PropertiesValue { get; set; }
	private string? RulesValue { get; set; }
	private string? SimilarityValue { get; set; }
	private bool? StoreValue { get; set; }
	private Elastic.Clients.Elasticsearch.Analysis.IcuCollationStrength? StrengthValue { get; set; }
	private string? VariableTopValue { get; set; }
	private string? VariantValue { get; set; }

	public IcuCollationPropertyDescriptor Alternate(Elastic.Clients.Elasticsearch.Analysis.IcuCollationAlternate? alternate)
	{
		AlternateValue = alternate;
		return Self;
	}

	public IcuCollationPropertyDescriptor CaseFirst(Elastic.Clients.Elasticsearch.Analysis.IcuCollationCaseFirst? caseFirst)
	{
		CaseFirstValue = caseFirst;
		return Self;
	}

	public IcuCollationPropertyDescriptor CaseLevel(bool? caseLevel = true)
	{
		CaseLevelValue = caseLevel;
		return Self;
	}

	public IcuCollationPropertyDescriptor CopyTo(Elastic.Clients.Elasticsearch.Fields? copyTo)
	{
		CopyToValue = copyTo;
		return Self;
	}

	public IcuCollationPropertyDescriptor Country(string? country)
	{
		CountryValue = country;
		return Self;
	}

	public IcuCollationPropertyDescriptor Decomposition(Elastic.Clients.Elasticsearch.Analysis.IcuCollationDecomposition? decomposition)
	{
		DecompositionValue = decomposition;
		return Self;
	}

	public IcuCollationPropertyDescriptor DocValues(bool? docValues = true)
	{
		DocValuesValue = docValues;
		return Self;
	}

	public IcuCollationPropertyDescriptor Dynamic(Elastic.Clients.Elasticsearch.Mapping.DynamicMapping? dynamic)
	{
		DynamicValue = dynamic;
		return Self;
	}

	public IcuCollationPropertyDescriptor Fields(Elastic.Clients.Elasticsearch.Mapping.Properties? fields)
	{
		FieldsValue = fields;
		return Self;
	}

	public IcuCollationPropertyDescriptor Fields<TDocument>(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor<TDocument> descriptor)
	{
		FieldsValue = descriptor.PromisedValue;
		return Self;
	}

	public IcuCollationPropertyDescriptor Fields<TDocument>(Action<Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor<TDocument>> configure)
	{
		var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor<TDocument>();
		configure?.Invoke(descriptor);
		FieldsValue = descriptor.PromisedValue;
		return Self;
	}

	public IcuCollationPropertyDescriptor HiraganaQuaternaryMode(bool? hiraganaQuaternaryMode = true)
	{
		HiraganaQuaternaryModeValue = hiraganaQuaternaryMode;
		return Self;
	}

	public IcuCollationPropertyDescriptor IgnoreAbove(int? ignoreAbove)
	{
		IgnoreAboveValue = ignoreAbove;
		return Self;
	}

	/// <summary>
	/// <para>Should the field be searchable?</para>
	/// </summary>
	public IcuCollationPropertyDescriptor Index(bool? index = true)
	{
		IndexValue = index;
		return Self;
	}

	public IcuCollationPropertyDescriptor IndexOptions(Elastic.Clients.Elasticsearch.Mapping.IndexOptions? indexOptions)
	{
		IndexOptionsValue = indexOptions;
		return Self;
	}

	public IcuCollationPropertyDescriptor Language(string? language)
	{
		LanguageValue = language;
		return Self;
	}

	/// <summary>
	/// <para>Metadata about the field.</para>
	/// </summary>
	public IcuCollationPropertyDescriptor Meta(Func<FluentDictionary<string, string>, FluentDictionary<string, string>> selector)
	{
		MetaValue = selector?.Invoke(new FluentDictionary<string, string>());
		return Self;
	}

	public IcuCollationPropertyDescriptor Norms(bool? norms = true)
	{
		NormsValue = norms;
		return Self;
	}

	/// <summary>
	/// <para>Accepts a string value which is substituted for any explicit null values. Defaults to null, which means the field is treated as missing.</para>
	/// </summary>
	public IcuCollationPropertyDescriptor NullValue(string? nullValue)
	{
		NullValueValue = nullValue;
		return Self;
	}

	public IcuCollationPropertyDescriptor Numeric(bool? numeric = true)
	{
		NumericValue = numeric;
		return Self;
	}

	public IcuCollationPropertyDescriptor Properties(Elastic.Clients.Elasticsearch.Mapping.Properties? properties)
	{
		PropertiesValue = properties;
		return Self;
	}

	public IcuCollationPropertyDescriptor Properties<TDocument>(Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor<TDocument> descriptor)
	{
		PropertiesValue = descriptor.PromisedValue;
		return Self;
	}

	public IcuCollationPropertyDescriptor Properties<TDocument>(Action<Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor<TDocument>> configure)
	{
		var descriptor = new Elastic.Clients.Elasticsearch.Mapping.PropertiesDescriptor<TDocument>();
		configure?.Invoke(descriptor);
		PropertiesValue = descriptor.PromisedValue;
		return Self;
	}

	public IcuCollationPropertyDescriptor Rules(string? rules)
	{
		RulesValue = rules;
		return Self;
	}

	public IcuCollationPropertyDescriptor Similarity(string? similarity)
	{
		SimilarityValue = similarity;
		return Self;
	}

	public IcuCollationPropertyDescriptor Store(bool? store = true)
	{
		StoreValue = store;
		return Self;
	}

	public IcuCollationPropertyDescriptor Strength(Elastic.Clients.Elasticsearch.Analysis.IcuCollationStrength? strength)
	{
		StrengthValue = strength;
		return Self;
	}

	public IcuCollationPropertyDescriptor VariableTop(string? variableTop)
	{
		VariableTopValue = variableTop;
		return Self;
	}

	public IcuCollationPropertyDescriptor Variant(string? variant)
	{
		VariantValue = variant;
		return Self;
	}

	protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings)
	{
		writer.WriteStartObject();
		if (AlternateValue is not null)
		{
			writer.WritePropertyName("alternate");
			JsonSerializer.Serialize(writer, AlternateValue, options);
		}

		if (CaseFirstValue is not null)
		{
			writer.WritePropertyName("case_first");
			JsonSerializer.Serialize(writer, CaseFirstValue, options);
		}

		if (CaseLevelValue.HasValue)
		{
			writer.WritePropertyName("case_level");
			writer.WriteBooleanValue(CaseLevelValue.Value);
		}

		if (CopyToValue is not null)
		{
			writer.WritePropertyName("copy_to");
			JsonSerializer.Serialize(writer, CopyToValue, options);
		}

		if (!string.IsNullOrEmpty(CountryValue))
		{
			writer.WritePropertyName("country");
			writer.WriteStringValue(CountryValue);
		}

		if (DecompositionValue is not null)
		{
			writer.WritePropertyName("decomposition");
			JsonSerializer.Serialize(writer, DecompositionValue, options);
		}

		if (DocValuesValue.HasValue)
		{
			writer.WritePropertyName("doc_values");
			writer.WriteBooleanValue(DocValuesValue.Value);
		}

		if (DynamicValue is not null)
		{
			writer.WritePropertyName("dynamic");
			JsonSerializer.Serialize(writer, DynamicValue, options);
		}

		if (FieldsValue is not null)
		{
			writer.WritePropertyName("fields");
			JsonSerializer.Serialize(writer, FieldsValue, options);
		}

		if (HiraganaQuaternaryModeValue.HasValue)
		{
			writer.WritePropertyName("hiragana_quaternary_mode");
			writer.WriteBooleanValue(HiraganaQuaternaryModeValue.Value);
		}

		if (IgnoreAboveValue.HasValue)
		{
			writer.WritePropertyName("ignore_above");
			writer.WriteNumberValue(IgnoreAboveValue.Value);
		}

		if (IndexValue.HasValue)
		{
			writer.WritePropertyName("index");
			writer.WriteBooleanValue(IndexValue.Value);
		}

		if (IndexOptionsValue is not null)
		{
			writer.WritePropertyName("index_options");
			JsonSerializer.Serialize(writer, IndexOptionsValue, options);
		}

		if (!string.IsNullOrEmpty(LanguageValue))
		{
			writer.WritePropertyName("language");
			writer.WriteStringValue(LanguageValue);
		}

		if (MetaValue is not null)
		{
			writer.WritePropertyName("meta");
			JsonSerializer.Serialize(writer, MetaValue, options);
		}

		if (NormsValue.HasValue)
		{
			writer.WritePropertyName("norms");
			writer.WriteBooleanValue(NormsValue.Value);
		}

		if (!string.IsNullOrEmpty(NullValueValue))
		{
			writer.WritePropertyName("null_value");
			writer.WriteStringValue(NullValueValue);
		}

		if (NumericValue.HasValue)
		{
			writer.WritePropertyName("numeric");
			writer.WriteBooleanValue(NumericValue.Value);
		}

		if (PropertiesValue is not null)
		{
			writer.WritePropertyName("properties");
			JsonSerializer.Serialize(writer, PropertiesValue, options);
		}

		if (!string.IsNullOrEmpty(RulesValue))
		{
			writer.WritePropertyName("rules");
			writer.WriteStringValue(RulesValue);
		}

		if (!string.IsNullOrEmpty(SimilarityValue))
		{
			writer.WritePropertyName("similarity");
			writer.WriteStringValue(SimilarityValue);
		}

		if (StoreValue.HasValue)
		{
			writer.WritePropertyName("store");
			writer.WriteBooleanValue(StoreValue.Value);
		}

		if (StrengthValue is not null)
		{
			writer.WritePropertyName("strength");
			JsonSerializer.Serialize(writer, StrengthValue, options);
		}

		writer.WritePropertyName("type");
		writer.WriteStringValue("icu_collation_keyword");
		if (!string.IsNullOrEmpty(VariableTopValue))
		{
			writer.WritePropertyName("variable_top");
			writer.WriteStringValue(VariableTopValue);
		}

		if (!string.IsNullOrEmpty(VariantValue))
		{
			writer.WritePropertyName("variant");
			writer.WriteStringValue(VariantValue);
		}

		writer.WriteEndObject();
	}

	IcuCollationProperty IBuildableDescriptor<IcuCollationProperty>.Build() => new()
	{
		Alternate = AlternateValue,
		CaseFirst = CaseFirstValue,
		CaseLevel = CaseLevelValue,
		CopyTo = CopyToValue,
		Country = CountryValue,
		Decomposition = DecompositionValue,
		DocValues = DocValuesValue,
		Dynamic = DynamicValue,
		Fields = FieldsValue,
		HiraganaQuaternaryMode = HiraganaQuaternaryModeValue,
		IgnoreAbove = IgnoreAboveValue,
		Index = IndexValue,
		IndexOptions = IndexOptionsValue,
		Language = LanguageValue,
		Meta = MetaValue,
		Norms = NormsValue,
		NullValue = NullValueValue,
		Numeric = NumericValue,
		Properties = PropertiesValue,
		Rules = RulesValue,
		Similarity = SimilarityValue,
		Store = StoreValue,
		Strength = StrengthValue,
		VariableTop = VariableTopValue,
		Variant = VariantValue
	};
}